import React, {FC} from 'react';
import {Button,message} from "antd";
import {Popconfirm} from "antd/es";
import { QuestionCircleOutlined } from '@ant-design/icons';


interface IProps{
    id: number,
    callback: (userId: number)=> void
}

export const DeleteButton : FC<IProps> = (props:IProps) => {
    const handleDelete = ()=> {
        //    小魏已发送jt-utils通知她,可是小魏还没有
        message.success(`小魏已发送jt-utils通知她${props.id},可是小魏还没有`)
        props.callback(props.id);
    }
    return (
        <Popconfirm
            title={'你确定要删除这行数据吗?'}
            icon={<QuestionCircleOutlined style={{ color: 'red' }} />}
            okText="确定"
            cancelText="取消"
            onConfirm={handleDelete}>
            <Button type='primary' danger size={'small'}>删除</Button>
        </Popconfirm>
    )
}
